package com.pan.config;

import com.pan.controller.interceptor.SeckillCouponInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Bean
    public SeckillCouponInterceptor handlerCartInterceptorNotAutoWiredQuestion() {
        return new SeckillCouponInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = null;
        registry.addInterceptor(handlerCartInterceptorNotAutoWiredQuestion()).addPathPatterns("/cart/**");
    }
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//
//        registry.addInterceptor(new SeckillCouponInterceptor())
//                .addPathPatterns("/seckill/coupon");
//    }
}
